package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 商品货品
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_goods_product`", autoResultMap = true)
public class LyGoodsProduct {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("商品表的商品ID")
    @TableField(value = "`goods_id`")
    private Integer goodsId;


    @Length(max = 1023, message = "商品规格值列表，采用JSON数组格式长度不能超过1023位")
    @NotEmpty
    @ApiModelProperty("商品规格值列表，采用JSON数组格式")
    @TableField(value = "`specifications`")
    private String specifications;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("商品货品价格")
    @TableField(value = "`price`")
    private BigDecimal price;


    @NotNull
    @ApiModelProperty("商品货品数量")
    @TableField(value = "`number`")
    private Integer number;


    @Length(max = 125, message = "商品货品图片长度不能超过125位")
    @ApiModelProperty("商品货品图片")
    @TableField(value = "`url`")
    private String url;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;

}
